import 'package:flutter/material.dart';
import 'package:get/get.dart';

class AppLifeCycleDelegate with WidgetsBindingObserver {

  static final AppLifeCycleDelegate _appLifeCycleDelegate = AppLifeCycleDelegate._init();

  AppLifeCycleDelegate._init() {
    WidgetsBinding.instance?.addObserver(this);
  }

  factory AppLifeCycleDelegate() {
    return _appLifeCycleDelegate;
  }

  @override
  void didChangePlatformBrightness() {
    super.didChangePlatformBrightness();
    //手机主题发生变化 强制触发 build
    Get.forceAppUpdate();
  }
}
